<template>
    <div class="wrapper">
<!--        <div class="way">Home <span>></span> <span class="currentTab">{{ title }}</span></div>-->
        <MainViewContent :data="pageContent" :time="time"></MainViewContent>
<!--        <TopViewInfo></TopViewInfo>-->
        <MainViewMoreNews  v-if="recommendedNewsShow"
                           :data="pageContent.ref_article"></MainViewMoreNews>
<!--        <TopViewPressContacts></TopViewPressContacts>-->
    </div>

</template>

<script setup lang="ts">
import { ref, reactive } from 'vue'

useHead({
  title: 'Exeed Newsroom',//网站标题
  link: [//网站link，可以在这里引入css和icon等
    { rel: 'shortcut icon', href: '/images/favicon.ico' },
    { rel: 'apple-touch-icon', href: '/images/favicon.ico' }
  ]
})

const config = useRuntimeConfig();
const apiURL = config.public.apiURL;

let searchText = ref('')
const route = useRoute()

// 当访问/posts/1时，route.params.id将为1
const token = route.query.token;
const {data: content} = token ? await useFetch(`/api/page/getSketchById?id=${route.params.id}&token=${token}`) : await useFetch(`/api/page/getPageById?id=${route.params.id}`);

const title = ref('');
const type =  ref('')
const time = ref(new Date().getTime())

const pageContent = ref('');
if (content.value) {
  title.value = content.value.data.title;
  type.value = content.value.data.pageContent.type;
  if(content.value.data.publishTime && content.value.data.publishTime > 0){
    time.value = content.value.data.publishTime;
  }
  pageContent.value = content.value.data.pageContent;
}

const recommendedNewsShow = ref(false)
if(pageContent.value.ref_article.length >0){
  recommendedNewsShow.value = true;
}

const pressContactVisible = ref(false);
</script>

<style scoped lang="scss">
.wrapper {
    background-color: #FFFFFF;
    width: 1920px;
    .way {
        width: 1920px;
        height: 50px;
        padding: 0px 90px;
        padding-top: 126px;
        vertical-align: middle;

        .currentTab {
            font-size: 16px;
            font-weight: 400;
            color: #C78E66;
        }
    }

}
</style>
